package com.lzh.farmersshop.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzh.farmersshop.mapper.OrderdetailsMapper;
import com.lzh.farmersshop.entity.Orderdetails;
import com.lzh.farmersshop.service.OrderdetailsService;
import com.lzh.farmersshop.util.Result;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * (Orderdetails)表服务实现类
 *
 * @author makejava
 * @since 2024-01-04 15:37:11
 */
@Service("orderdetailsService")
public class OrderdetailsServiceImpl extends ServiceImpl<OrderdetailsMapper, Orderdetails> implements OrderdetailsService {


    @Override
    public List<Map<String,Object>> findAllByOrdernum(Long orderid) {
        return baseMapper.findAllByOrdernum(orderid);
    }

    @Override
    public List<Orderdetails> findAllByOrdernums(List<Long> orderNums) {
        return baseMapper.findAllByOrdernums(orderNums);
    }

    @Override
    public Result selectAll(Orderdetails orderdetails, Integer page, Integer limit) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("count",baseMapper.selectAllCount(orderdetails));
        result.put("data",baseMapper.selectAll(orderdetails,(page-1)*limit,limit));
        return Result.success(result);
    }
}

